<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
      /* 定位方案---绝对定位，两边内填充 */
        .p1{
            height: 100px;
            width: 100%;
            padding-left: 100px;
            padding-right: 100px;
            position: relative;
            box-sizing: border-box;
            background-color: gray;
            border: 1px black dashed;
        }
        .p1 .left{
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            width: 100px;
            background-color: pink;
        }
        .p1 .right{
            position: absolute;
            right: 0;
            top: 0;
            height: 100%;
            width: 100px;
            background-color: pink;
        }
        .p1 .mid{
            width: 100%;
            height: 100%;
            background-color: orange;
            color: black;
            font-size: 24px;
        }
/* ---------------------------------flex方案 */
.p2{
    height: 100px;
    width: 100%;
    display: flex;
    background-color: green;
    margin-top: 24px;
}
.p2 .left{
    height: 100px;
    width: 100px;
    background-color: black;
}
.p2 .mid{
    flex: 1;
    height: 100px;
    width: 100px;
}
.p2 .right{
    height: 100px;
    width: 100px;
    background-color: black;
}
    </style>
</head>
<body>
    <!-- 绝对定位档案 -->
    <div class='p1'>
        <div class="left"></div>
        <div class="mid">hello world</div>
        <div class="right"></div>
    </div>
    <!-- flex布局方案 -->
    <div class='p2'>
        <div class="left"></div>
        <div class="mid">hello world</div>
        <div class="right"></div>
    </div>
    <!-- 浮动方案 -->
    
</body>
</html>